/**
    入驻小区
**/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            adminCommunityInfo: {
                communitys: [
                    {
                        communityId:'',
                        shopName:'全部'
                    }
                ],
                communityId:'',
                callBack:{}
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            vc.on('adminCommunity', 'initCommunity', function (_param) {
                $that.adminCommunityInfo.callBack = _param;
                $that._listAdminCommunitys(DEFAULT_PAGE, DEFAULT_ROWS);
            });
        },
        methods: {
           
            _listAdminCommunitys: function(_page, _rows) {
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                    }
                };
                let _communitys = [
                    {
                        communityId:'',
                        name:'全部'
                    }
                ];

                //发送get请求
                vc.http.apiGet('/community.queryAdminCommunity',
                    param,
                    function(json, res) {
                        let _json = JSON.parse(json);
                        _json.data.forEach(s => {
                            _communitys.push(s);
                        });
                        $that.adminCommunityInfo.communitys = _communitys;
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            swatchAdminCommunityId:function(_shop){
                $that.adminCommunityInfo.communityId = _shop.communityId;
                $that.adminCommunityInfo.callBack(_shop);
            },
          
            
        }
    });
})(window.vc);
